import { request } from '@/utils/request'

//保存用户信息
export const saveUser = function (entity) {
  return request.post('/user', entity)
}

//删除用户信息
export const removeUser = function (id) {
  return request.delete(`/user/${id}`)
}

//更新用户信息
export const updateUser = function (id, entity) {
  return request.put(`/user/${id}`, entity)
}

//获得某个用户详细
export const getUser = function (id) {
  return request.get(`/user/${id}`)
}

//分页查找用户
export const pageUser = function (current, size) {
  return request.get(`/user/page?current=${current}&size=${size}`)
}

//给用户绑定角色信息
export const lockRoles = function (userId, roleId) {
  return request.post(`/user/role?userId=${userId}&roleId=${roleId}`)
}

//给用户解绑角色信息
export const unlockRoles = function (userId, roleId) {
  return request.delete(`/user/role?userId=${userId}&roleId=${roleId}`)
}

//绑定手机账号
export const lockPhone = function (userId, phone) {
  return request.post(`/user/phone?userId=${userId}&phone=${phone}`)
}

//删除手机账号
export const unlockPhone = function (userId, phone) {
  return request.delete(`/user/phone?userId=${userId}&phone=${phone}`)
}
